package com.framework.dao;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.framework.entity.tran.TranBenefitDay;
import com.framework.page.PageUtils;
import com.framework.view.DividedSumDto;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 功能描述: 分润明细
 *
 * @author ck
 * @date 2018/9/6 13:54
 */
public interface BenefitDayDao extends BaseMapper<TranBenefitDay> {

	DividedSumDto queryTransMonthSum(@Param("lastMonth") String lastMonth, @Param("lastTwoMonth") String lastTwoMonth, @Param("agentId") Long agentId,@Param("types")String types);

	BigDecimal getThisMonthAmount(@Param("agentId")Long agentId, @Param("types")Integer types);

	BigDecimal getDayAmount(@Param("agentId")Long agentId, @Param("types")Integer types,@Param("dayTime")String dayTime);

	BigDecimal getMonthAmount(@Param("agentId")Long agentId, @Param("types")Integer types,@Param("monthTime")String monthTime);

	/**
	 * 后台 查询个人分润信息
	 * @param params
	 * @return
	 */
	List<Map<String,Object>> queryListByAgentId(Map<String,Object> params);

	/**
	 * 后台 个人分润信息数量，用于分页
	 * @param params
	 * @return
	 */
	Integer queryCountByAgentId(Map<String,Object> params);

	/**
	 * 修改
	 * @param t
	 */
	void updatebenefitDay(@Param("ex") TranBenefitDay t);

	/**
	 * 查询出然后添加至流水
	 * @param benefitDateStr
	 * @return
	 */
	List<TranBenefitDay> queryToAddFlowAccount(@Param("benefitDate") String benefitDateStr);

	/**
	 * 添加日分润
	 * @param t
	 */
    void addBenefitDay(@Param("ex") TranBenefitDay t);

	/**
	 * 查询回退
	 * @param deptId
	 * @param date
	 * @return
	 */
    List<TranBenefitDay> queryReback(@Param("deptId") Long deptId,@Param("date") Date date);

	List<TranBenefitDay> queryPushFlowAccount(@Param("benefitDate") String benefitDateStr,@Param("deptId") Long deptId);

    Map<String, Object> queryAgentIdSum(@Param("agentId") Long agentId, @Param("month") String s);
}
